//
//  SettingCell.m
//  mendianjieke
//
//  Created by 响当当 on 8/21/19.
//  Copyright © 2019 dongzheng. All rights reserved.
//

#import "MySettingCell.h"

@interface MySettingCell()
@property (nonatomic, strong)UILabel *titleLabel;//标题
@property (nonatomic, strong)UILabel *SubTitle;//副标题
@property (nonatomic, strong)UIImageView *iconRowImageView;//箭头
@end

@implementation MySettingCell

- (UILabel *)titleLabel
{
    if (!_titleLabel)
    {
        _titleLabel = [Utilties creatLabelWithFrame:CGRectMake(15*kUIScaleBasePlus,15*kUIScaleBasePlus,120*kUIScaleBasePlus, 20*kUIScaleBasePlus)
                                       textAligment:NSTextAlignmentLeft
                                           textClor:LCHexColor(0x282828)
                                           textFont:14*kUIScaleBasePlus];
    }
    return _titleLabel;
}

- (UILabel *)SubTitle
{
    if (!_SubTitle)
    {
        _SubTitle = [Utilties creatLabelWithFrame:CGRectMake(SCREEN_WIDTH-15*kUIScaleBasePlus-120*kUIScaleBasePlus,15*kUIScaleBasePlus,120*kUIScaleBasePlus,20*kUIScaleBasePlus)
                                     textAligment:NSTextAlignmentRight
                                         textClor:LCHexColor(0x989898)
                                         textFont:14*kUIScaleBasePlus];
        
    }
    return _SubTitle;
}

- (UIImageView *)iconRowImageView
{
    if (!_iconRowImageView)
    {
        _iconRowImageView = [[UIImageView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-16*kUIScaleBasePlus-6*kUIScaleBasePlus,19*kUIScaleBasePlus,6*kUIScaleBasePlus,12*kUIScaleBasePlus)];
        _iconRowImageView.image = [UIImage imageNamed:@"liebiaogengduo"];
        _iconRowImageView.hidden = YES;
    }
    return _iconRowImageView;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self)
    {
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.SubTitle];
        [self.contentView addSubview:self.iconRowImageView];

    }
    
    return self;
}

- (void)setModel:(MySettingModel *)model
{
    _model = model;
    
    self.titleLabel.text = model.title;
    [self.titleLabel sizeToFit];
    
    if ([model.subTitle isEqualToString:@""])
    {
        self.SubTitle.hidden = YES;
    }
    else
    {
        self.SubTitle.text = model.subTitle;
    }
    
    if (model.row.integerValue == 1)
    {
        self.iconRowImageView.hidden = YES;
    }
    else
    {
        self.iconRowImageView.hidden = NO;
    }
}

- (void)cleanSys
{
    
    self.SubTitle.text = @"0.0M";

    DISMISS_SVP(1.0)
    [SVProgressHUD showSuccessWithStatus:@"清除成功"];
}
@end
